// pages/moreresource/moreresource.js
//获取应用实例
var app = getApp();
//引用
var fileData = require('../../utils/data.js')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    // banner_url: fileData.getBannerData(),
    interval: 3000,
    duration: 1000,
    vertical: false,
    indicatordots: true,
    autoplay: true,
    indicatored: '#F08631',
    indicator: '#fff',
    navTopItems: fileData.getIndexNavData(),
    curNavId: 1,
    curIndex: 0,
    colors: ["red", "orange", "yellow", "green", "purple"],
    focus: '',
    // advert_url: fileData.getAdvertData(),
    userInfo: '',
    typelist: []
  },
  bingfocusFunc: function (e) {
    this.setData({
      focus: 'focus'
    })
  },
  bingblurFunc: function (e) {
    this.setData({
      focus: ''
    })
  },
  switchTap: function (e) {
    var url;
    var data = this.data.typelist[e.currentTarget.dataset.index];
    if (data.url) {
      url = data.url;
    } else {
      url = '../../pages/healthCareSeach/healthCareSeach';
    }
    wx.navigateTo({
      url: url + "?item=" + JSON.stringify(data)
    })
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    this.setData({
      userInfo: JSON.parse(wx.getStorageSync('userInfo'))
    })
    this.getAllType();
    // this.setData({ weatherApikey: getApp().globalData.weatherApikey });
    // this.loadLocation();
  },
  getAllType:function(e){
    var that=this;
    wx.request({
      url: app.globalData.httpApiCar + 'tGyIndustryResource/all',
      method: 'POST',
      header: {
        'content-type': 'application/x-www-form-urlencoded' // 默认值
      },
      success: function (res) {
        if (res.data.success) {
          that.setData({
            typelist: res.data.data
          })
        }
      }
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {

  }
})